import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
// import ElementPlus from 'element-plus';
// import 'element-plus/dist/index.css';
// 全局错误屏蔽配置
const suppressErrors = () => {
  // 1. 屏蔽所有console错误
  void [console.error = () => { }];

  // 2. 处理Vue错误
  const app = createApp(App);
  app.config.errorHandler = () => { };

  // 3. 捕获全局错误
  window.onerror = () => true;

  // 4. 处理ResizeObserver错误
  window.addEventListener('error', e => {
    if (e.message.includes('ResizeObserver')) e.preventDefault();
  });

  // 5. 处理未处理的Promise拒绝
  window.addEventListener('unhandledrejection', e => {
    e.preventDefault();
  });

  // 6. 覆盖ResizeObserver
  const originalResizeObserver = window.ResizeObserver;
  window.ResizeObserver = class extends originalResizeObserver {
    constructor(callback) {
      super(entries => {
        try {
          callback(entries);
        } catch {
          // 忽略ResizeObserver错误
        }
      });
    }
  };
};

suppressErrors();

// 创建Vue应用
const app = createApp(App);
app.use(router);
app.mount('#app');
